<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@include file="../connection.jsp"%>

<%
 //HttpSession session = request.getSession();
 //session = request.getSession();
  
  String userid = (String)session.getAttribute("admin");
  
  if(userid==null)
  {
  	response.sendRedirect("../login.jsp");
  }
  
  Connection c = getAdminConnection();
  Statement s = c.createStatement();  
  
  String userToChange = request.getParameter("userid");
  String status = request.getParameter("status");
  
  if(status.equals("0")){
  	s.executeUpdate("update users set active=0 where userid='"+userToChange+"'");
  }else if(status.equals("1")){
  	s.executeUpdate("update users set active=1 where userid='"+userToChange+"'");
  }
  
  s.close();
  c.close();
  
  response.sendRedirect("users-list.jsp?update=1");
%>
